package cc.magicjson.data.operation.router.db.service;

import cc.magicjson.data.operation.router.db.exception.DatabaseOperationException;

import java.util.List;

public interface DataOperationService {
    // 单个实体操作
    <T> T save(T entity, Class<T> entityClass) throws DatabaseOperationException;
    <T> void delete(T entity, Class<T> entityClass);
    <T> T update(T entity, Class<T> entityClass);

    // 批量操作
    <T> List<T> batchSave(List<T> entities, Class<T> entityClass);
    <T> void batchDelete(List<T> entities, Class<T> entityClass);
    <T> List<T> batchUpdate(List<T> entities, Class<T> entityClass);

    // 查询操作
    <T> T findById(Object id, Class<T> entityClass);
    <T> List<T> findByCondition(Object condition, Class<T> entityClass);
}
